/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package klasy;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Grzegorz
 */
@Entity
@Table(name = "pacjent", catalog = "pai1", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Pacjent.findAll", query = "SELECT p FROM Pacjent p"),
    @NamedQuery(name = "Pacjent.findByIdPacjent", query = "SELECT p FROM Pacjent p WHERE p.idPacjent = :idPacjent"),
    @NamedQuery(name = "Pacjent.findByImie", query = "SELECT p FROM Pacjent p WHERE p.imie = :imie"),
    @NamedQuery(name = "Pacjent.findByNaziwsko", query = "SELECT p FROM Pacjent p WHERE p.naziwsko = :naziwsko"),
    @NamedQuery(name = "Pacjent.findByTelefon", query = "SELECT p FROM Pacjent p WHERE p.telefon = :telefon"),
    @NamedQuery(name = "Pacjent.findByPesel", query = "SELECT p FROM Pacjent p WHERE p.pesel = :pesel"),
    @NamedQuery(name = "Pacjent.findByMiasto", query = "SELECT p FROM Pacjent p WHERE p.miasto = :miasto"),
    @NamedQuery(name = "Pacjent.findByKodPocztowy", query = "SELECT p FROM Pacjent p WHERE p.kodPocztowy = :kodPocztowy"),
    @NamedQuery(name = "Pacjent.findByUlica", query = "SELECT p FROM Pacjent p WHERE p.ulica = :ulica"),
    @NamedQuery(name = "Pacjent.findByNrDomu", query = "SELECT p FROM Pacjent p WHERE p.nrDomu = :nrDomu"),
    @NamedQuery(name = "Pacjent.findByNrLokum", query = "SELECT p FROM Pacjent p WHERE p.nrLokum = :nrLokum")})
public class Pacjent implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_pacjent")
    private Integer idPacjent;
    @Column(name = "imie")
    private String imie;
    @Column(name = "naziwsko")
    private String naziwsko;
    @Column(name = "telefon")
    private Integer telefon;
    @Column(name = "pesel")
    private String pesel;
    @Column(name = "Miasto")
    private String miasto;
    @Column(name = "kod_pocztowy")
    private String kodPocztowy;
    @Column(name = "ulica")
    private String ulica;
    @Column(name = "nr_domu")
    private Integer nrDomu;
    @Column(name = "nr_lokum")
    private Integer nrLokum;

    public Pacjent() {
    }

    public Pacjent(Integer idPacjent) {
        this.idPacjent = idPacjent;
    }

    public Integer getIdPacjent() {
        return idPacjent;
    }

    public void setIdPacjent(Integer idPacjent) {
        this.idPacjent = idPacjent;
    }

    public String getImie() {
        return imie;
    }

    public void setImie(String imie) {
        this.imie = imie;
    }

    public String getNaziwsko() {
        return naziwsko;
    }

    public void setNaziwsko(String naziwsko) {
        this.naziwsko = naziwsko;
    }

    public Integer getTelefon() {
        return telefon;
    }

    public void setTelefon(Integer telefon) {
        this.telefon = telefon;
    }

    public String getPesel() {
        return pesel;
    }

    public void setPesel(String pesel) {
        this.pesel = pesel;
    }

    public String getMiasto() {
        return miasto;
    }

    public void setMiasto(String miasto) {
        this.miasto = miasto;
    }

    public String getKodPocztowy() {
        return kodPocztowy;
    }

    public void setKodPocztowy(String kodPocztowy) {
        this.kodPocztowy = kodPocztowy;
    }

    public String getUlica() {
        return ulica;
    }

    public void setUlica(String ulica) {
        this.ulica = ulica;
    }

    public Integer getNrDomu() {
        return nrDomu;
    }

    public void setNrDomu(Integer nrDomu) {
        this.nrDomu = nrDomu;
    }

    public Integer getNrLokum() {
        return nrLokum;
    }

    public void setNrLokum(Integer nrLokum) {
        this.nrLokum = nrLokum;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idPacjent != null ? idPacjent.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Pacjent)) {
            return false;
        }
        Pacjent other = (Pacjent) object;
        if ((this.idPacjent == null && other.idPacjent != null) || (this.idPacjent != null && !this.idPacjent.equals(other.idPacjent))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "klasy.Pacjent[ idPacjent=" + idPacjent + " ]";
    }
    
    public String getName(){
        return this.imie + " " + this.naziwsko;
    }
}
